package com.klouda.platakybeta;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    
    public void onGroupItemNovyLekClick(MenuItem item) {
      //setContentView(R.layout.lek_edit_layout);
      Intent l_intent = new Intent("com.klouda.platakybeta.LekEditActivity");
      startActivity(l_intent);
    }
    
    public void onGroupItemLekyClick(MenuItem item) {
        // One of the group items (using the onClick attribute) was clicked
        // The item parameter passed here indicates which item it is
        // All other menu item clicks are handled by onOptionsItemSelected()
    	
        TableRow.LayoutParams params = new TableRow.LayoutParams(100, 100);

        TableLayout table = new TableLayout(this);
        table.setBackgroundColor(Color.GREEN);
        
        for (int i = 0; i < 3; i++) {
            TableRow row = new TableRow(this);
            for (int j = 0; j < 3; j++) {
                TextView text = new TextView(this);
                text.setLayoutParams(params);
                text.setText(String.format("(%d, %d)", i, j));
                row.addView(text);
            }
            table.addView(row);
        }
        setContentView(table);
    }    	
    	
   
    
    
}
